package com.qk.management.mapper;

import com.qk.entity.Course;
import org.apache.ibatis.annotations.*;


import java.util.List;

/**
 * @author 李智勇
 * @data 2025/10/5 14:46
 */
@Mapper
public interface CourseMapper {

    @Select("select * from course where subject = #{subjectId}")
    List<Course> selectBySubject(Integer subjectId);

    @Select("select * from course")
    List<Course> selectAll();

    @Delete("delete from course where id = #{id}")
    void deleteById(Integer id);

    void update(Course course);

    @Select("select * from course where id = #{id}")
    Course selectById(Integer id);

    List<Course> selectBypage(@Param("subject") Integer subject,
                              @Param("name") String name,
                              @Param("target") Integer target);

    @Insert("insert into course(subject,name,price,target,description,create_time,update_time) values(#{subject},#{name},#{price},#{target},#{description},#{createTime},#{updateTime})")
    void insert(Course course);


}